5 DIM DAT(20):CLS:SCREEN 0:WIDTH 80:KEY OFF:SCR=1:FOR D=1 TO 11:READ DAT(D):NEXT:RESTORE:COLOR 7,0
6 LOCATE 12,25:PRINT"PRESS SPACEBAR FOR INSTRUCTIONS":LOCATE 13,26:PRINT"PRESS ANY OTHER KEY TO START":GOSUB 6000
10 X$=INKEY$:IF X$="" THEN 10
17 IF X$=" " THEN GOSUB 5000
20 IF ASC(X$)>47 AND ASC(X$)<58 THEN REGISTER=VAL(X$):OUT 980,REGISTER:FOR X=1 TO REGISTER:PLAY"L15 C":NEXT:REG=981
30 IF X$="," THEN 35 ELSE 40
35 DAT(REG-980+REGISTER)=DAT(REG-980+REGISTER)-1:IF DAT(REG-980+REGISTER)<0 THEN DAT(REG-980+REGISTER)=0:BEEP
36 OUT REG,DAT(REG-980+REGISTER)
40 IF X$="." THEN 45 ELSE 50
45 DAT(REG-980+REGISTER)=DAT(REG-980+REGISTER)+1:IF DAT(REG-980+REGISTER)>255 THEN DAT(REG-980+REGISTER)=255:BEEP
46 OUT REG,DAT(REG-980+REGISTER)
50 IF X$="M" OR X$="m" THEN REG=984:REGISTER=7
55 IF X$=CHR$(27) THEN GOSUB 200
60 IF X$="C" OR X$="c" THEN REG=985:REGISTER=7
65 IF X$="T" OR X$="t" THEN GOSUB 72
66 IF X$="Y" OR X$="y" THEN GOSUB 74
67 IF X$="U" OR X$="u" THEN GOSUB 76
70 GOTO 10
72 CLS:SCREEN 0:WIDTH 80:FOR X=1 TO 23:COLOR X,0:PRINT TAB(10);X;"HELLO";X:NEXT:SCR=1:GOSUB 4000:RETURN
74 SCREEN 1:FOR T=1 TO 3:CIRCLE (T*75,100),90,T:PAINT (T*75,100),T,T:NEXT:LOCATE 1,1:PRINT"HERE IS SOME TEXT. CAN YOU READ THIS.":SCR=2:GOSUB 4000:RETURN
76 SCREEN 2:CIRCLE (320,100),200:PAINT (320,100),1,1:LOCATE 1,20:PRINT" HERE IS SOME TEXT. CAN YOU READ THIS.":SCR=3:GOSUB 4000:RETURN
100 'USE NUMERIC KEYS TO SELECT 6845 REGISTERS
110 EXAMPLE: PRESS '4' TO SELECT REGISTER 4
120 '
130 PRESS 'A' FOR 984(MODE REGISTER), AND '`' FOR 985(COLOR REGISTER)
140 '
150 'GREATER THAN AND LESS THAN KEYS INCREMENT AND DECREMENT SELECTED REGISTERS,
160 'RESPECTIVELY. 'T' GIVES TEXT DISPLAY. 'Y' GIVES MED-RES. DISPLAY.
170 ''U' GIVES HI-RES. DISPLAY
200 A=1
201 CLS
210 X=1
220 X$=INKEY$:IF X$="" THEN 220
225 IF X$=CHR$(27) THEN RETURN
227 IF VAL(X$)>0 AND VAL(X$)<10 THEN A=VAL(X$)
230 LINE (X,0)-(X,100)
235 IF X>630 THEN RETURN
240 X=X+A:GOTO 220
250 RETURN
2000 DEF SEG=&HB800:FOR X=0 TO 65535!:POKE X,255:NEXT
3000 DATA &h71,&h50,&h5a,&h0a,&h1f,6,&h19,&h1c,2,7,&h29,0
3010 DATA &h38,&h28,&h2d,&h0a,&h7f,6,&h64,&h70,2,1,&h2a,48
3020 DATA &h38,&h28,&h2d,&h0a,&h7f,6,&h64,&h70,2,1,&h1e,15
4000 IF BY=1 THEN RETURN
4005 FOR L=1 TO SCR:FOR D=1 TO 12:READ DAT(D):NEXT:NEXT
5200 FOR D=1 TO 10:OUT 980,D-1:OUT 981,DAT(D):NEXT:OUT 984,DAT(11):OUT 985,DAT(12):RETURN
6000 X$=INKEY$:IF X$="" THEN 6000
6010 IF X$<>" " THEN CLS:GOTO 10
6020 CLS:PRINT"THIS PROGRAM LETS YOU PLAY AROUND WITH THE VIDEO REGISTERS IN THE 6845 GRAPHICS CHIP ON THE STANDARD IBM COLOR GRAPHICS BOARD. THREE SAMPLE DISPLAYS ARE PROVIDED TO SEE THE EFFECTS OF CHANGING VALUES AND ARE AS FOLLOWS:"
6030 PRINT:PRINT"PRESS 'T' TO SEE A SAMPLE DISPLAY IN TEXT MODE"
6040 PRINT"PRESS 'Y' TO SEE A SAMPLE DISPLAY IN MEDIUM RESOLUTION GRAPHICS."
6050 PRINT"PRESS 'U' TO SEE A SAMPLE DISPLAY IN HIGH RESOLUTION GRAPHICS."
6060 PRINT:PRINT"TEN REGISTERS ARE AVAILABLE FOR BIT TWIDDLING. THESE REGISTERS ARE ACCESSED BY PRESSING THE NUMBERS ON THE TOP ROW OF THE KEYBOARD. FOR EXAMPLE, PRESS'4' TO SELECT REGISTER 4 FOR MODIFICATION."
6070 PRINT"THE REGISTERS ARE NUMBERED ZERO THROUGH NINE.THE COMPUTER WILL BEEP OUT THE NUMBER OF THE REGISTER. AS IN THE ABOVE EXAMPLE, THE COMPUTER WOULD BEEP FOUR TIMES."
6080 PRINT:PRINT"TO MODIFY THE REGISTER YOU HAVE SELECTED, USE THE '<' AND '>' KEYS. THE '>' KEY INCREMENTS THE VALUE PRESENTY IN THE REGISTER AND THE '<' KEY DECREMENTS THE VALUE IN THE REGISTER."
6090 PRINT"THE COMPUTER WILL BEEP IF YOU TRY TO GO BELOW ZERO OR ABOVE 255."
6100 LOCATE 24,24:PRINT"Press any key to continue";
6110 X$=INKEY$:IF X$="" THEN 6110
6120 CLS:PRINT"TWO PORTS ON THE GRAPHICS CHIP ARE ALSO AVAILABLE. THESE ARE THE MODE REGISTER AND THE COLOR SELECT REGISTER. THE TECHNICAL REFERENCE GUIDE WILL EXPLAIN THESE PORTS."
6130 PRINT:PRINT"TO SELECT THE MODE REGISTER FOR MODIFICATION, PRESS 'M'."
6140 PRINT"TO SELECT THE COLOR SELECT REGISTER FOR MODIFICATION, PRESS 'C'."
6150 PRINT:PRINT"AGAIN, THE '<' AND '>' KEYS CHANGE THE VALUE IN THE SELECTED REGISTER. TO DISPLAY WHAT VALUES ARE CURRENTLY IN ALL ACCESSABLE REGISTERS, PRESS THE SPACEBAR."
6155 PRINT"THIS IS USEFUL IN CASE YOU WANT TO WRITE DOWN THE VALUES TO USE IN CASE YOU FIND ANY NEW PALETTES OR GRAPHICS TRICKS (HINT HINT).